<include file="public@header" />
</head>
<body>
    <div class="layui-fluid js-check-wrap">
        <div class="layui-card">
            <div class="layui-card-header">
                <h3>{:lang('ADMIN_USER_INDEX')}</h3>
            </div>
            <div class="layui-card-body">
                <form action="{:url('User/wechat')}" class="form-search layui-form layui-form-item clearfix">
                    <div class="layui-col-md11 layui-col-sm10">
                        <div class="layui-inline">
                            <label class="layui-form-label">用户名:</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="user_login" value="{:input('request.user_login/s','')}" placeholder="请输入{:lang('USERNAME')}">
                            </div>
                        </div>
                        
                        <div class="layui-inline">
                            <input type="submit" class="layui-btn layui-btn-normal" value="搜索" />
                        </div>
                        <div class="layui-inline">
                            <a class="layui-btn layui-btn-danger" href="{:url('User/wechat')}">清空</a>
                        </div>
                    </div>

                    <div class="layui-col-md1 layui-col-sm2">
                        <button id="update" class="layui-btn layui-btn-normal fr js-ajax-shenhe" >更新用户数据</button>
                    </div>
                </form>
            </div>
            <table class="layui-table">
                <thead>
                    <tr>
                        <th width="50">ID</th>
                        <th>{:lang('USERNAME')}</th>
                        <th>{:lang('MOBILE')}</th>
                        <th>部门</th>
                    </tr>
                </thead>
                <tbody>
                    <foreach name="users" item="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.user_login}</td>
                        <td>{$vo.mobile}</td>
                        <th>{$vo.name}</th>
                    </tr>
                    </foreach>
                </tbody>
            </table>

            <if condition="$page">
                <div class="pagination-row clearfix">
                    <div class="pages">{$page|default=''}</div>
                </div>
            </if>
        </div>
    </div>
<include file="public@footer" />
<script type="text/javascript">
    $("#update").click(function() {
        alert('稍后将自动更新完成');
        $.ajax({ 
            url: "{:url('user/wechatupdate')}", 
            type:"POST",
            data: {
            },
            dataType:"json",
            success: function(data){
                if (data.status == 0) {
                    alert(data.msg);
                    window.location.reload();
                }else{
                    alert(data.msg);
                    window.location.reload()
                }
            } ,
            error:function(){
                console.log("失败");
            }
        });
    });
</script>
